import type { RouteRecordName } from "vue-router";
import type { Component } from "vue";

export type cacheType = {
  mode: string;
  name?: RouteRecordName;
};

export type positionType = {
  startIndex?: number;
  length?: number;
};

export type appType = {
  sidebar: {
    opened: boolean;
    withoutAnimation: boolean;
    // 判断是否手动点击Collapse
    isClickCollapse: boolean;
  };
  layout: string;
  device: string;
  sortSwap: boolean;
};

export type multiType = {
  path: string;
  name: string;
  meta: any;
  query?: object;
  params?: object;
};

export type setType = {
  title: string;
  fixedHeader: boolean;
  hiddenSideBar: boolean;
};

export type userType = {
  username?: string;
  roles?: Array<string>;
  verifyCode?: string;
  currentPage?: number;
  isRemembered?: boolean;
  loginDay?: number;
};

// 科目类型 目前支持4种： WATER ELECTRICTITY GAS MACHINE
export enum SubjectTypes {
  WATER = "WATER",
  ELECTRICTITY = "ELECTRICTITY",
  GAS = "GAS",
  MACHINE = "MACHINE"
}

export enum SubjectChineseTypes {
  WATER = "水课",
  ELECTRICTITY = "电课",
  GAS = "气化课",
  MACHINE = "机械课"
}

/**
 * 副目录
 * isActive      当前副路由是否激活（默认 false）
 * menu          副路由唯一键，和 viceMenu 中的 menus 保持一致
 * menuName      副路由名称
 * icon          副路由svg组件
 * activeIcon    副路由svg组件（激活状态）
 */
export type viceMenusTypes = {
  isActive: boolean;
  menu: string;
  menuName: string;
  icon: Component;
  activeIcon: Component;
};

export type RouterPathTypes = SubjectTypes | "ALL";

export type RouterPathChineseTypes = SubjectChineseTypes | "all";

export type routerType = {
  subject?: RouterPathTypes;
  pmsClass?: string;
  subjectChinses?: RouterPathChineseTypes;
  showViceMenus?: Boolean;
  activeViceMenu: string;
  currentViceMenus?: Array<viceMenusTypes>;
  bottomFooterHeight?: Number;
  leftWidth?: Number;
};
